import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

export default new Router({
  routes: [
    {
      path: "/",
      name: "doremi",
      redirect: "/doremi/user",
      component: () => import("@/moudle/index.vue"),
      children: [
        {
          path: "/doremi/user",
          name: "user",
          component: () => import("@/moudle/doremi/user.vue")
        },
        //批量执行
        {
          path: "/doremi/batch",
          name: "batch",
          component: () => import("@/moudle/doremi/batch.vue")
        },
        //环境管理
        {
          path: "/doremi/env",
          name: "env",
          component: () => import("@/moudle/doremi/env.vue")
        },
        //接口管理
        {
          path: "/doremi/service",
          name: "service",
          component: () => import("@/moudle/doremi/service.vue")
        },
        //共享SQL
        {
          path: "/doremi/s-rules",
          name: "s-rules",
          component: () => import("@/moudle/doremi/s-rules.vue")
        },
        //树点击
        {
          path: "/doremi/tree:id",
          props: true,
          name: "tree-main",
          component: () => import("@/moudle/doremi/tree-main.vue")
        },
      ]
    },
    {
      path: "/VueUeditorWrap",
      name: "VueUeditorWrap",
      component: () => import("@/components/doremi/VueUeditorWrap.vue")
    },
    {
      path: "/demo3",
      name: "demo3",
      component: () => import("@/moudle/doremi/demo3.vue")
    },
    {
      path: "/table",
      name: "table",
      component: () => import("@/moudle/doremi/table.vue")
    },
  ]
});